package com.ruoyi.web.controller.project.excel;

import lombok.Data;
import org.apache.poi.ss.usermodel.Row;

import java.util.LinkedList;
import java.util.UUID;

@Data
public class ZlRow {
    /**
     * 行ID
     */
    private String rowNo;
    //行
    private Row row;
    //sheet对象
    private ZlSheet sheet;

    private int rowIndex;
    /**
     * 所有列
     */
    private LinkedList<ZlCell> cells = new LinkedList<>();

    public ZlRow(ZlSheet sheet,Integer index){
        this(sheet,index,23);
    }

    public ZlRow(ZlSheet sheet,Integer index,Integer height){
        this.rowIndex = index;
        this.sheet = sheet;
        this.row = this.sheet.getSheet().createRow(index);
        //默认设置行数为23
        this.row.setHeightInPoints(height);
        this.rowNo = UUID.randomUUID().toString();
    }

    private ZlRow addCell(ZlCell cell){
        this.cells.addLast(cell);
        return this;
    }
}
